package day18_987;

import java.util.*;

/**
 * @ClassName Solution1
 * @Description TODO
 * @Author clockTown
 * @Date 2021/5/27 22:01
 * @Version 1.0
 */
public class Solution1 {
    public List<List<Integer>> verticalTraversal(TreeNode root) {


        return null;
    }


    public HashMap<Integer, List<Integer>> verticalTraversal(TreeNode root, HashMap<Integer, List<Integer>> map, Integer col) {
        if (root == null) {
            return map;
        }
        if (map.containsKey(col)){
            List<Integer> oldList = map.get(col);
            oldList.add(root.val);
            map.put(col, oldList);
        }else{
            List<Integer> newList = new ArrayList<>();
            newList.add(root.val);
            map.put(col, newList);
        }


        map = verticalTraversal(root.left, map, col - 1);
        map = verticalTraversal(root.right, map, col + 1);

        return map;
    }

}
